import 'dart:convert';

import 'package:meta/meta.dart';

///定义Talentmodel
class TalentModel {
  TalentModel(
      { this.avatar="https://sydney.edu.au/AcademicProfiles/profile/resource?urlid=michael.bell",
        this.id,
        this.first_name,
        this.middle_name,
        this.last_name,
        this.name,
        this.job_title,
        this.country,
        this.major,
        this.organization,
        this.phone,
        this.email,
        this.personal_website,
        this.short_bio,

});
  var avatar = "https://sydney.edu.au/AcademicProfiles/profile/resource?urlid=michael.bell";
  var id;
  var first_name;
  var middle_name;
  var last_name;
  var name;
  var job_title;
  var country;
  var major;
  var organization;
  var phone;
  var email;
  var personal_website;
  var short_bio;

  static List<TalentModel> fromJson(String json) {
    List<TalentModel> listModel = new List<TalentModel>();
    List list = jsonDecode(json)['list'];
    list.forEach((v) {
      var model = fromMap(v);
      listModel.add(model);
    });

    return listModel;
  }

  String get _avatar => avatar;
  String get _first_name => first_name;
  String get _middle_name => middle_name;
  String get _last_name => last_name;
  String get _name => name;
  String get _job_title => job_title;
  String get _country => country;
  String get _major => major;
  String get _organization => organization;
  String get _phone => phone;
  String get _email => email;
  String get _personal_website => personal_website;
  String get _short_bio => short_bio;


  Map<String,dynamic> toMap(){
    var map=new Map<String,dynamic>();
    map['First Name'] = _first_name;
    map['Middle Name'] = _middle_name;
    map['Last Name'] = _last_name;
    map['Name'] = _name;
    map['Job Title'] = _job_title;
    map['Country'] = _country;
    map['Major'] = _major;
    map['Organization'] = _organization;
    map['Phone'] = _phone;
    map['Email'] = _email;
    map['Personal Website'] = _personal_website;
    map['Short Bio'] = _short_bio;
    return map;
  }


  static TalentModel fromMap(Map map) {
    return new TalentModel(
        first_name: map['First Name'],
        middle_name: map['Middle Name'],
        last_name: map['Last Name'],
        name: map['Name'],
        job_title: map['Job Title'],
        country: map['Country'],
        major: map['Major'],
        organization: map['Organization'],
        phone: map['Phone'],
        email: map['Email'],
        personal_website: map['Personal Website'],
        short_bio: map['Short Bio'],
    );
  }
}
